/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gmao.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Amine
 */
@Entity
@Table(name = "tache")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tache.findAll", query = "SELECT t FROM Tache t"),
    @NamedQuery(name = "Tache.findByNom", query = "SELECT t FROM Tache t WHERE t.nom = :nom"),
    @NamedQuery(name = "Tache.findByDescription", query = "SELECT t FROM Tache t WHERE t.description = :description"),
    @NamedQuery(name = "Tache.findByPrMa", query = "SELECT t FROM Tache t WHERE t.prMa = :prMa"),
    @NamedQuery(name = "Tache.findByIdentif", query = "SELECT t FROM Tache t WHERE t.identif = :identif")})
public class Tache implements Serializable {
    private static final long serialVersionUID = 1L;
    @Size(max = 1)
    @Column(name = "nom")
    private String nom;
    @Size(max = 2147483647)
    @Column(name = "description")
    private String description;
    @Column(name = "pr_ma")
    private Boolean prMa;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "identif")
    private Integer identif;
    
    @OneToMany(mappedBy = "identif")
    private List<TacheProduction> tacheProductionList;
    @JoinColumn(name = "identif_tacheprod", referencedColumnName = "identif_tacheprod")
    @ManyToOne
    private TacheProduction identifTacheprod;
    
    @JoinColumn(name = "ident_intervention", referencedColumnName = "ident_intervention")
    @ManyToOne
    private Intervention identIntervention;
    
    @JoinColumn(name = "matricule", referencedColumnName = "matricule")
    @ManyToOne
    private Employe matricule;
    @OneToMany(mappedBy = "identif")
    private List<Intervention> interventionList;

    public Tache() {
    }

    public Tache(Integer identif) {
        this.identif = identif;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Boolean getPrMa() {
        return prMa;
    }

    public void setPrMa(Boolean prMa) {
        this.prMa = prMa;
    }

    public Integer getIdentif() {
        return identif;
    }

    public void setIdentif(Integer identif) {
        this.identif = identif;
    }

    @XmlTransient
    public List<TacheProduction> getTacheProductionList() {
        return tacheProductionList;
    }

    public void setTacheProductionList(List<TacheProduction> tacheProductionList) {
        this.tacheProductionList = tacheProductionList;
    }

    public TacheProduction getIdentifTacheprod() {
        return identifTacheprod;
    }

    public void setIdentifTacheprod(TacheProduction identifTacheprod) {
        this.identifTacheprod = identifTacheprod;
    }

    public Intervention getIdentIntervention() {
        return identIntervention;
    }

    public void setIdentIntervention(Intervention identIntervention) {
        this.identIntervention = identIntervention;
    }

    public Employe getMatricule() {
        return matricule;
    }

    public void setMatricule(Employe matricule) {
        this.matricule = matricule;
    }

    @XmlTransient
    public List<Intervention> getInterventionList() {
        return interventionList;
    }

    public void setInterventionList(List<Intervention> interventionList) {
        this.interventionList = interventionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (identif != null ? identif.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tache)) {
            return false;
        }
        Tache other = (Tache) object;
        if ((this.identif == null && other.identif != null) || (this.identif != null && !this.identif.equals(other.identif))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.gmao.entities.Tache[ identif=" + identif + " ]";
    }
    
}
